﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

using UnitLibrary.GameObjects;
using FarseerGames.FarseerPhysics.Dynamics;
using Microsoft.Xna.Framework.Graphics;
using UnitLibrary.Utility;

namespace UnitLibrary.Managers
{
    public class CapturePointM: UnitM<CapturePoint>
    {
        public CapturePointM(Game game, ComponentM gameScreen, string capturepointset)
            : base(game, gameScreen, UnitID.Border)
        {            
        }

        public CapturePointM(Game game, ComponentM components, int numberofcapturepoints)
           
            : base(game, components, UnitID.Border)
        {
            _numberofCapturePoints = numberofcapturepoints;
        }
        
        /// <summary>
        /// The number of capture points on this map
        /// </summary>
        private int _numberofCapturePoints;

        /// <summary>
        /// The numbeer of capture points on this map which have been captured
        /// </summary>
        private int _numberofPointsCaptured = 0;
        /// <summary>
        /// Returns the number of capture points
        /// </summary>
        public int NumberOfCapturePoints
        {
            get { return _numberofCapturePoints; }
        } 

        public int PointsCaptured
        {
            get { return _numberofPointsCaptured; }
        }

        public RPool<CapturePoint> CapturePoints
        {
            get { return _unitPool; }
        }

        public override void LoadContent()
        {
            //temporarily use generic values before creating xml documents for different capture point
            RPool<CapturePoint>.Node point;
            for(int i = 0; i < _numberofCapturePoints; i++)
            {
                //point = _unitPool.Retrieve();
                //point.Item.SetPlayerGeom(_components.playerManager.player.PType.Geom);
                //point.Item.TimeNeededForCapture = 5000;
                //point.Item.LoadasBall(this.Game.GraphicsDevice, _components.physicsSimulator, new Body(), new GeomData(), Color.Orange, Color.Black, 100, 0);
                //point.Item.Body.Position.X = _components.mapManager.RandomSafeSpot().X;
                //point.Item.Body.Position.Y = _components.mapManager.RandomSafeSpot().Y; 
            }
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            
        }
        
    }
}
